Skip to content

feat: add MirrorNodeAccountBalanceQuery - #1814

Merged
Dosik13 merged 9 commits into
mainfrom
feat/1792-mirror-node-account-balance-query
Aug 20, 2026
Merged

feat: add MirrorNodeAccountBalanceQuery#1814
Dosik13 merged 9 commits into
mainfrom
feat/1792-mirror-node-account-balance-query

Conversation

@Dosik13

@Dosik13 Dosik13 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description:

The consensus node stops serving CryptoService/cryptoGetBalance in release 0.77, which retires
AccountBalanceQuery. Add its mirror node replacement, built to the merged
migration proposal.

  • Add MirrorNodeAccountBalanceQuery, reading GET /api/v1/balances?account.id={id}
  • Add MirrorNodeAccountBalance, carrying the hbar balance
  • Add AccountID._MirrorNodePathID so an EVM-address alias is sent as bare hex and a public key
    alias as unpadded base32, and route the existing _MirrorNodeRequest through it
  • Consolidate the mirror node REST calls onto one retry core and move FeeEstimateQuery,
    MirrorNodeContractQuery and RegisteredNodeAddressBookQuery onto it
  • Add an example under examples/mirror_node_account_balance
  • Fix a nil-pointer panic in PopulateAccount: it dereferenced *id.AliasEvmAddress unconditionally, so it
    panicked on any AccountID without an EVM alias.
  • Skip checksum validation for IDs sent as an alias — an alias has no checksum, so
    validating one rejected the EVM-address and public-key forms SetAccountID documents
  • Default the retry budget to the mirror node's 3 attempts instead of 10, capping a
    failing query at ~91s instead of ~5.7 minutes

Related issue(s):

Fixes #1792

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@lfdt-bot

lfdt-bot commented Aug 18, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.94382% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdk/mirror_node_rest_helpers.go 93.75% 2 Missing and 2 partials ⚠️
sdk/registered_node_address_book_query.go 90.90% 1 Missing and 1 partial ⚠️
sdk/account_id.go 94.11% 1 Missing ⚠️
sdk/fee_estimate_query.go 75.00% 1 Missing ⚠️
sdk/mirror_node_contract_query.go 80.00% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
sdk/errors.go 65.51% <ø> (ø)
sdk/mirror_node.go 71.85% <100.00%> (ø)
sdk/mirror_node_account_balance_query.go 100.00% <100.00%> (ø)
sdk/account_id.go 71.95% <94.11%> (+1.12%) ⬆️
sdk/fee_estimate_query.go 82.85% <75.00%> (+4.40%) ⬆️
sdk/mirror_node_contract_query.go 68.85% <80.00%> (+1.92%) ⬆️
sdk/registered_node_address_book_query.go 87.00% <90.90%> (+7.32%) ⬆️
sdk/mirror_node_rest_helpers.go 92.55% <93.75%> (+1.92%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dosik13
Dosik13 force-pushed the feat/1792-mirror-node-account-balance-query branch from f49a276 to e791b66 Compare August 19, 2026 12:43
@Dosik13
Dosik13 marked this pull request as ready for review August 19, 2026 12:45
@Dosik13
Dosik13 requested review from a team as code owners August 19, 2026 12:45
@Dosik13
Dosik13 requested a review from gsstoykov August 19, 2026 12:45
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
@Dosik13
Dosik13 force-pushed the feat/1792-mirror-node-account-balance-query branch from a7aa4f3 to 6ba3824 Compare August 20, 2026 11:57
@Dosik13
Dosik13 merged commit d7d25ef into main Aug 20, 2026
16 checks passed
@Dosik13
Dosik13 deleted the feat/1792-mirror-node-account-balance-query branch August 20, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement MirrorNodeAccountBalanceQuery as mirror node replacement for AccountBalanceQuery

3 participants